import { defineStore } from "pinia";
import { ref, computed } from "vue";

interface TabBarItem {
  name: string;
  text: string;
  pagePath: string;
  iconPath: string;
  selectedIconPath: string;
}

export const usePageStore = defineStore("page", () => {
  // 使用 ref 替代 state
  const tabBarList = ref<TabBarItem[]>([
    {
      name: "index",
      text: "医疗服务",
      pagePath: "/pages/index/index",
      iconPath: "/static/icon/tabbar/home.png",
      selectedIconPath: "/static/icon/tabbar/home_active.png",
    },
    {
      name: "message",
      text: "消息通知",
      pagePath: "/pages/message/index",
      iconPath: "/static/icon/tabbar/message.png",
      selectedIconPath: "/static/icon/tabbar/message_active.png",
    },
    {
      name: "profile",
      text: "个人中心",
      pagePath: "/pages/profile/index",
      iconPath: "/static/icon/tabbar/profile.png",
      selectedIconPath: "/static/icon/tabbar/profile_active.png",
    },
  ]);

  const getTabBarList = computed(() => tabBarList.value);

  function setTabBarList(list: TabBarItem[]) {
    tabBarList.value = list;
  }

  return { tabBarList, getTabBarList, setTabBarList };
});
